#ifndef SRC_BASE_EVENT_H__
#define SRC_BASE_EVENT_H__

#include "base/basictypes.h"
#include "base/common.h"

#if defined(OS_WIN)
#include "base/win32.h"  // NOLINT: consider this a system header.
#elif defined(OS_UNIX)
#include <pthread.h>
#else
#error "Must define either OS_WIN or OS_UNIX."
#endif

namespace vz {

class Event {
 public:
  Event(bool manual_reset, bool initially_signaled);
  ~Event();

  void Set();
  void Reset();
  bool Wait(int cms);

 private:
  bool is_manual_reset_;

#if defined(OS_WIN)
  bool is_initially_signaled_;
  HANDLE event_handle_;
#elif defined(OS_UNIX)
  bool event_status_;
  pthread_mutex_t event_mutex_;
  pthread_cond_t event_cond_;
#endif
};

}  // namespace vz

#endif  // SRC_BASE_EVENT_H__
